Skip to content

feat: stig-ubuntu2204 revision 2: 38 audit rule controls, and an audit collector - #309

Merged
with-developer merged 3 commits into
mainfrom
feat/stig-audit-rules
Nov 14, 2026
Merged

with-developer merged 3 commits into
mainfrom
feat/stig-audit-rules

Conversation

@with-developer

Copy link
Copy Markdown
Owner

What changes

stig-ubuntu2204 goes from 27 to 65 controls of the 188 of V2R8 (revision 2): the 38 controls of the audit rules for commands, programs and files (UBTU-22-654010 to 654235, the ones that name a path). No other profile changes.

The audit collector

New collector audit (facts audit.paths, audit.user_paths): it reads the audit rules the host loads at boot from /etc/audit/rules.d/*.rules (name order, symbolic links followed, as augenrules does), or /etc/audit/audit.rules without them. It reads files only, through internal/hostfs, nothing is run, and no secret can be in them (the -k keys are dropped). It says what it can decide and nothing more:

  • A rule counts only if it audits every event for its path: a rule narrowed by another filter (auid=, uid=, success=, exit=, ...), or for some system calls only, is left out; a never rule for a path removes the path (the kernel takes the first rule that matches, so before or after); a never rule that names no path, a delete rule (-d), an include (-R), an unknown line, an invalid permission, more than 100 files, 5000 rules, a line over 4 KiB or a file over 1 MiB make the facts incomplete, so a check on them is ERROR, never a pass.
  • -D deletes what came before; the form -a always,exit -S all -F path=... -F perm=x -F auid>=1000 -F auid!=unset (also -1, 4294967295) is the STIG's form for a command and fills user_paths; -w and path=/dir= rules with perm= fill paths.
  • Real fixtures: the default rules.d/audit.rules that the Ubuntu 22.04 auditd package installs (taken from a container), and a stig.rules made of the fix text of the 38 controls. A fuzz target (FuzzAuditRules) ran 3 million executions clean, twice.

The checks

audit.command-audited (the STIG's command form, for logged-in users) and audit.path-audited (a watch or a path rule with perm=, per letter r, w, a, x). Both are generic (the profile gives the path), N/A on a container image, and tested for PASS, FAIL, absent and incomplete.

Verified on a real host

On a stock ubuntu:22.04 container with auditd installed: the 38 controls FAIL with its default rules and PASS with the STIG's rules in rules.d; adding -a never,exit -F path=/usr/bin/sudo makes UBTU-22-654105 FAIL.

Review

/code-review high (new parser of host files): ten findings, all addressed: narrowing filters and never rules counted as audited (false PASS), symlinked rules files and surplus files dropped silently, the size limit applied after the read, an option and a rule on one line, invalid permissions, substring comparison of permissions (now per letter), the unused rule list in the facts (removed). Documented, not changed: a rule on a directory (dir=) counts for the directory, not the files in it, and paths are the STIG's own spelling (/bin/su, not /usr/bin/su): a false FAIL, never a false PASS, said in the check and docs/stig.md.

Docs

docs/stig.md and .ko.md (65 of 188, the audit rules, what is not read), README en/ko, the generated English page (65 controls). Control titles are ours, IDs and importance the STIG's; the rule lines in the fixture are the STIG's example rules (a US government work).

…it collector, audit.path-audited and audit.command-audited)
… count, symlinked and surplus files, perms validated, per-letter permissions, a size check before the read, no rule list in the facts)
@with-developer
with-developer merged commit 1273153 into main Nov 14, 2026
20 checks passed
@with-developer
with-developer deleted the feat/stig-audit-rules branch November 14, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant